//
//  SCString.swift
//  SwiftCommon
//
//  Created by lijl on 15/7/23.
//  Copyright (c) 2015年 lijialong. All rights reserved.
//

import Foundation

// MARK: - 字符串
extension String {
    
    /**
    字符串截取，从头开始
    
    :param: endIndex 从头开始截取，到哪一个索引号结束
    
    :returns: 截取后的字符串
    */
    func subString(let endIndex:Int)->String{
        
        let startIndex = self.startIndex
        let index = advance(startIndex, endIndex)
        return self.substringToIndex(index)
    }
    
    
    /// 字符串的长度
    var length: Int {
        return count(self)
    }
    
}